package customer.zspt.cn.customer.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.lidroid.xutils.BitmapUtils;

import java.util.List;

import customer.zspt.cn.customer.R;
import customer.zspt.cn.customer.bean.ServexDao;
import customer.zspt.cn.customer.Widget.ContactItemView;

/**
 * Created by Administrator on 2018/7/12 0012.
 */
public class ServexAdapter extends BaseAdapter{
    private BitmapUtils utils;
    private List<ServexDao.Info> infos;
    private Context context;
    public ServexAdapter(Context context, List<ServexDao.Info> infos){
        utils = new BitmapUtils(context);
        this.context = context;
        utils.configDefaultLoadingImage(R.drawable.default_fmessage);
        this.infos = infos;
    }

    @Override
    public int getCount() {
        return infos.size();
    }

    @Override
    public Object getItem(int position) {
        return infos.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View view, ViewGroup viewGroup) {
        ContactItemView servexview = new ContactItemView(context);
        servexview.setText(infos.get(position).servexTitle);
        ImageView setvexitem_ig = servexview.getTitleView();
        utils.display(setvexitem_ig,infos.get(position).servexAvatar);
        return servexview;
    }
}